package edu.szu.huhanpeng.doodlingFight.controller.mainHandler 
{
	import edu.szu.huhanpeng.doodlingFight.model.data.GameData;
	import edu.szu.huhanpeng.doodlingFight.model.ScoreProxy;
	import edu.szu.huhanpeng.doodlingFight.view.PlayerWindowMed;
	import org.puremvc.as3.interfaces.IAsyncCommand;
	import org.puremvc.as3.interfaces.ICommand;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.interfaces.INotifier;
	import org.puremvc.as3.patterns.command.AsyncCommand;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	/**
	 * ...
	 * @author Huhanpeng
	 */
	public class GetScoreSc extends SimpleCommand implements ICommand, INotifier 
	{
		
		override public function execute(note:INotification):void 
		{
			var scoreProxy:ScoreProxy = facade.retrieveProxy( ScoreProxy.NAME ) as ScoreProxy;
			var playerWindowMed:PlayerWindowMed;
			switch ( scoreProxy.owner ) 
			{
				case GameData.P_ONE:
					playerWindowMed = facade.retrieveMediator( PlayerWindowMed.P_ONE_NAME ) as PlayerWindowMed;
				break;
				
				case GameData.P_TWO:
					playerWindowMed = facade.retrieveMediator( PlayerWindowMed.P_TWO_NAME ) as PlayerWindowMed;
				default:
			}
			
			playerWindowMed.setScore( scoreProxy.score );
		}
		
	}

}